<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:a4j="http://richfaces.org/a4j"
                 xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <title>报销管理系统</title>
        <script type="text/javascript">
            function updateCostItemName(code, name)
            {
                document.getElementById('abrodForm:costcode').value = code;
                document.getElementById('abrodForm:costname').value = name;
            }
            function showCostItem() {
                window.open("./page/pay/check/ecoList.jsf", "经济科目", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
        </script>
        <style type="text/css">
            table.backTable input{
                border: none;
            }

            table.voucherGrid{
                width:100%;
                border:1px solid #e2e2e2;
                border-collapse:collapse;
            }
            table.voucherGrid td{
                border:1px solid #e2e2e2;
            }
            .demo_fieldset {
                margin : 20px;
                border : 1px solid #ACBECE;
            }

            .demo_legend {
                font-weight : bold;
                margin : 0px 10px 0px 18px;
                font-family: Verdana;
            }
            .inputstype{
                width: 175px !important;
            }
            .pic{
                margin-bottom: -4px;
                margin-right: -2px;
                border:none;
                width:20px;
                height:20px;
            }
            .col1{
                width:80px;
                vertical-align: top;
            }
        </style>

    </h:head>

    <h:form id="abrodForm">
        <rich:panel header="出国差旅费审核" styleClass="content-hight">
            <rich:messages globalOnly="true"/>
            <h:panelGrid columns="2">
                <h:outputLabel value="单据状态:"/>
                <h:panelGroup>
                    <h:outputText value="审核通过"  rendered="#{abroadGroupCheckBean.abroad.numberStatus == '2'}" style="color:blue"/>
                    <h:outputText value="退回修改"  rendered="#{abroadGroupCheckBean.abroad.numberStatus == '3'}" style="color:red"/>
                    <h:outputText value="等待审核"  rendered="#{abroadGroupCheckBean.abroad.numberStatus == '0'}" style="color:green"/>
                    <h:outputText value="支付成功"  rendered="#{abroadGroupCheckBean.abroad.numberStatus == '4'}" style="color:blue"/>
                    <h:outputText value="支付完毕"  rendered="#{abroadGroupCheckBean.abroad.numberStatus == '6'}" style="color:blue"/>
                </h:panelGroup>
            </h:panelGrid>
            <rich:toolbar  itemSeparator="grida">
                <rich:toolbarGroup>
                    <h:commandLink  action="#{abroadGroupCheckBean.checkandRep}"
                                    onclick="return confirm('确定通过？');"
                                    disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}">
                        <h:graphicImage value="./images/check.png" styleClass="pic" title="通过" />
                    </h:commandLink>
                    <h:commandLink action="#{abroadGroupCheckBean.back}"
                                   onclick="return confirm('确定退回？');"
                                   disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}">
                        <h:graphicImage value="./images/return.png" styleClass="pic" title="退回" />
                    </h:commandLink>
                    <h:commandLink  action="#{abroadGroupCheckBean.cancelChecked}"
                                    disabled="#{abroadGroupCheckBean.abroad.numberStatus != '2'}">
                        <h:graphicImage value="./images/chexiao.png" styleClass="pic" title="撤销" />
                    </h:commandLink>
                    <h:commandLink  action="#{abroadGroupCheckBean.getFirst}"
                                    disabled="#{abroadGroupCheckBean.dis.first}">
                        <h:graphicImage value="./images/btn_page_first.gif" styleClass="pic" title="首张" />
                    </h:commandLink>
                    <h:commandLink  action="#{abroadGroupCheckBean.previouse}"
                                    disabled="#{abroadGroupCheckBean.dis.previouse}">
                        <h:graphicImage value="./images/btn_page_up.gif" styleClass="pic" title="上张" />
                    </h:commandLink>
                    <h:commandLink  action="#{abroadGroupCheckBean.next}"
                                    disabled="#{abroadGroupCheckBean.dis.next}">
                        <h:graphicImage value="./images/btn_page_down.gif" styleClass="pic" title="下张" />
                    </h:commandLink>
                    <h:commandLink  action="#{abroadGroupCheckBean.getLast}"
                                    disabled="#{abroadGroupCheckBean.dis.last}">
                        <h:graphicImage value="./images/btn_page_end.gif" styleClass="pic" title="末张" />
                    </h:commandLink>
                    <h:commandLink  action="#{abroadGroupCheckBean.goback}" >
                        <h:graphicImage value="./images/goback.png" styleClass="pic" title="返回" />
                    </h:commandLink>
                </rich:toolbarGroup>
            </rich:toolbar>

            <fieldset class="demo_fieldset">
                <legend class="demo_legend">出国差旅费</legend>

                <h:panelGrid columns="6" width="100%" id="abroadBasic" styleClass="voucherGrid">
                    <h:outputLabel value="单据编号:"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.number}"/>

                    <h:outputLabel value="出国团组:"/>
                    <h:outputText id="groupName" value="#{abroadGroupCheckBean.abroad.group.name}"/>

                    <h:outputLabel value="国家:"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.group.country}"/>

                    <h:outputLabel value="填表人:"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.person}"/>

                    <h:outputLabel value="事由:"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.affair}"/>

                    <h:outputLabel value="人员列表:"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.group.member}"/>

                    <h:outputLabel value="费用承担部门:" />
                    <h:outputText  id="paydept"  value="#{abroadGroupCheckBean.abroad.payDept.name}"/>

                    <h:outputLabel value="报销人:" />
                    <h:outputText  id="feePerson"  value="#{abroadGroupCheckBean.abroad.feePer.cpsn_name}"/>

                    <h:outputLabel value="预算项目:"  />
                    <h:outputText  id="projName"  value="#{abroadGroupCheckBean.abroad.project.finName}"/>

                    <h:outputLabel value="附件张数:"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.affixAmount}"/>

                    <h:outputLabel value="备注"/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.memo}"/>

                    <h:outputLabel value="填单日期:" />
                    <h:outputText value="#{abroadGroupCheckBean.abroad.numDate}">
                        <f:convertDateTime pattern="yyyy年mm月dd日" timeZone="GMT+8"/>
                    </h:outputText>

                    <h:outputLabel value="出发日期:" />
                    <h:outputText value="#{abroadGroupCheckBean.abroad.group.startDate}">
                        <f:convertDateTime pattern="yyyy年mm月dd日" timeZone="GMT+8"/>
                    </h:outputText>

                    <h:outputLabel value="返回日期:" />
                    <h:outputText value="#{abroadGroupCheckBean.abroad.group.endDate}">
                        <f:convertDateTime pattern="yyyy年mm月dd日" timeZone="GMT+8"/>
                    </h:outputText>

                    <h:outputLabel value="支付方式: "/>
                    <h:outputText value="#{abroadGroupCheckBean.abroad.payStyle.name}"/>

                </h:panelGrid>

                <h:panelGroup id="groupCost" >
                    <div style="width:100%;height:auto;overflow:visible">
                        <rich:toolbar width="100%" style=" text-align:  center;" >
                            <h:outputLabel value="费用明细"/>
                        </rich:toolbar>

                        <rich:dataTable value="#{abroadGroupCheckBean.costModel}" var="co" id="fei" style=" width: 100%" >

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="行号"/>
                                </f:facet>
                                <h:outputText value="#{co.lineId}"/>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="币种代码"/>
                                </f:facet>
                                <h:outputText value="#{co.currency.code}"/>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="币种"/>
                                </f:facet>
                                <h:outputText id="groupCurrency#{co.lineId}" value="#{co.currency.name}"/>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="住宿费"/>
                                </f:facet>
                                <h:outputText value="#{co.stayCost}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="伙食补助费"/>
                                </f:facet>
                                <h:outputText value="#{co.foodCost}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column style=" text-align:  center;" >
                                <f:facet name="header">
                                    <h:outputText value="公杂费"/>
                                </f:facet>
                                <h:outputText value="#{co.mixCost}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="个人零用费"/>
                                </f:facet>
                                <h:outputText value="#{co.personalCost}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="城市间交通费"/>
                                </f:facet>
                                <h:outputText value="#{co.trafficCost}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="其他"/>
                                </f:facet>
                                <h:outputText value="#{co.other}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column style=" text-align:  center;">
                                <f:facet name="header">
                                    <h:outputText value="小计"/>
                                </f:facet>
                                <h:outputText value="#{co.other + co.trafficCost + co.personalCost + co.mixCost + co.foodCost + co.stayCost}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>
                        </rich:dataTable>
                    </div>
                </h:panelGroup>

                <h:panelGroup id="groupBack">
                    <rich:toolbar>
                        <h:outputLabel value="退领明细"/>
                    </rich:toolbar>
                    <rich:dataTable value="#{abroadGroupCheckBean.backModel}" var="tl" id="back" style=" width: 100%" >
                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:outputText value="行号"/>
                            </f:facet>
                            <h:outputText value="#{tl.lineId}"/>
                        </rich:column>

                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:outputText value="币种代码"/>
                            </f:facet>
                            <h:outputText value="#{tl.currency.code}"/>
                        </rich:column>

                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:outputText value="币种"/>
                            </f:facet>
                            <h:outputText value="#{tl.currency.name}"/>
                        </rich:column>

                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:outputText value="预借金额"/>
                            </f:facet>
                            <h:outputText value="#{tl.advance}" >
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>
                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:outputText value="退或领"/>
                            </f:facet>
                            <h:outputText value="#{tl.sign}" />
                        </rich:column>

                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:outputText value="退领金额"/>
                            </f:facet>
                            <h:outputText value="#{tl.amount}" >
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                    </rich:dataTable>
                </h:panelGroup>
            </fieldset>
            <fieldset class="demo_fieldset">
                <legend class="demo_legend">出国差旅费审核</legend>
                <h:panelGrid columns="4" width="100%" border="0" id="auditorCheck">
                    <h:outputLabel value="核定金额:"  />
                    <h:inputText  id="totalnew"   size="28" value="#{abroadGroupCheckBean.abroad.checkaccount}"
                                  disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}">
                        <f:convertNumber type="number" pattern="#,##0.00"/>
                    </h:inputText>
                    <h:outputText value="支出渠道:" />
                    <h:selectOneMenu  id="costType"  value="#{abroadGroupCheckBean.abroad.costTypes.code}"
                                      disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}"
                                      style=" width: 198px;">
                        <f:selectItem itemValue=" " itemLabel="-请选择-"/>
                        <f:selectItems value="#{class.selectItemList}" />
                    </h:selectOneMenu>
                    <h:outputText value="预算来源："  />
                    <h:selectOneRadio   value="#{abroadGroupCheckBean.abroad.budgetSource}"
                                        disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}" >
                        <f:selectItem itemLabel="当年预算" itemValue="当年预算"/>
                        <f:selectItem itemLabel="上年结余" itemValue="上年结余"/>
                    </h:selectOneRadio>
                    <h:outputText value="支出类别:" />
                    <h:selectOneRadio value="#{abroadGroupCheckBean.abroad.costClass}"
                                      disabled="true">
                        <f:selectItem itemLabel="基本支出" itemValue="0"/>
                        <f:selectItem itemLabel="项目支出" itemValue="1"/>
                    </h:selectOneRadio>
                    <h:outputLabel value="经济分类:" />
                    <h:inputText  id="costname"   size="28"  value="#{abroadGroupCheckBean.abroad.costitem.name}"
                                  disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}"       onclick="showCostItem()" />
                    <a4j:commandButton value="支付令:" render="paycode" action="#{abroadGroupCheckBean.buildpaycode}"
                                       disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}">
                    </a4j:commandButton>
                    <h:inputText  id="paycode" size="28"  value="#{abroadGroupCheckBean.abroad.paycode}"
                                  disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}"/>                    
                </h:panelGrid>
                <hr/>
                <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
                    <h:outputLabel value="审核意见:"/>
                    <h:inputTextarea value="#{abroadGroupCheckBean.abroad.checkInfo}" cols="100" disabled="#{abroadGroupCheckBean.abroad.numberStatus != '0'}"/>
                </h:panelGrid>
                <hr/>
                <h:panelGrid columns="4" width="100%" border="0" columnClasses="col1,col2,col1,col2">
                    <h:outputLabel value="审核人:" />
                    <h:outputText value="#{abroadGroupCheckBean.abroad.auditor}"/>
                    <h:outputLabel value="审核日期:" />
                    <h:outputText value="#{abroadGroupCheckBean.abroad.auditDate}">
                        <f:convertDateTime pattern="yyyy年MM月dd日"/>
                    </h:outputText>
                </h:panelGrid>
            </fieldset>
        </rich:panel>
    </h:form>
</ui:composition>